load 0013.mat
u1 = toframes(1,:);
v1 = toframes(2,:);
z = u1+v1.*i;
m = sqrt(u1.^2+v1.^2);
z = z./m;
% uv1 = cat(3,u1,v1);

v = -2:0.2:2;
h = fspecial('gaussian',[21 21],21);
[x,y] = meshgrid(v);
z1 = x + y*i;
z1 = z1.^2;
%m = abs(z);
%z = z./m;
% u = real(z);
% v = imag(z);
% uv = cat(3,u,v);

z1 = z1.*i.*h;
m1 = abs(z1);
z1 = z1./m1;
% u1 = real(z1);
% v1 = imag(z1);
% uv1 = cat(3,u1,v1);
[c,lags] = xcorr(z,z1,'unbiased');
%r =  myPearson(z,z1);
%rsp=abs(filter2(uv(:,:,1),uv1(:,:,1),'same')) + abs(filter2(uv(:,:,2),uv1(:,:,2),'same'));
% J=sum(rsp(1:end,:,:).^2,1);